<template>
  <div style="padding: 10px;">
    <div style="box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.2);margin: 10px 0px; padding: 5px;"
      v-for="(item,index) in list" :key="index">
      <div style="line-height: 35px;display: flex;">
        <div style="flex: 1;">采购单号:<span > {{item.reqcode}}</span></div>
        <div style="padding: 0px 10px;">
          <span v-if="item.deliver.name!=''">{{item.deliver.name}}</span>
          <span v-if="item.deliver.num==''" style="color: #FF0000;">未录入发货信息</span>
          <span v-if="item.deliver.num!=''">{{item.deliver.num}}</span>

        </div>
        <div>
          <span v-if="false">
            <el-input v-model="item.deliver_verifynum" placeholder="收寄件后4位" style="width: 120px;"></el-input>
          </span>
          <el-button v-if="false" @click="handlequery(index,item)">查询</el-button>
        </div>
      </div>
      <div>
        <el-table :data="item.goods" border>
          <el-table-column label="序号" type="index" width="50px"></el-table-column>
          <el-table-column label="标题" prop="title" show-overflow-tooltip></el-table-column>
          <el-table-column label="规格型号" prop="model" align="center"></el-table-column>
          <el-table-column label="单位" prop="unit" width="80px" align="center"></el-table-column>
          <el-table-column label="数量" prop="count" align="center"></el-table-column>
        </el-table>
      </div>
      <div>
        <div>
          <div v-for="(ditem,dindex) in item.deliver_info.data" :key="dindex" style="line-height: 20px;">
            <span>{{ditem.time}}{{ditem.context}}</span>
          </div>
        </div>
      </div>
    </div>

  </div>
</template>

<script>
  import md5 from 'js-md5';
  export default {
    data() {
      return {
        list: []
      }
    },
    created() {
      var uid = this.$route.query.uid;
      this.loadDataList(uid);
      console.log("用户id", uid);
    },
    methods: {
      loadDataList(uid) {
        this.axios.post("api/common/deliver/list", {
          uid: uid
        }).then((res) => {
          if (res.status == 200 && res.data.code == 1) {
            this.list = res.data.list;
          }
          console.log(res);
        })
      },
      handlequery(index,data){
         const params={
           name:this.list[index].deliver.name,
           num:this.list[index].deliver.num,
           code:this.list[index].deliver_verifynum,

         }
        this.axios.post("api/common/deliver/query",params).then((res) => {
          if (res.status == 200 && res.data.code == 1) {
            this.list = res.data.list;
          }
          console.log(res);
        })
      }
    }
  }
</script>

<style>
</style>
